function centerSearch(data, target) {
	let result = null;
	// 拿取到中间的数
	const mid = Math.floor(data.length / 2);
	let i = mid;
	let c = target > data[i];
	if (c) {
		for (let k = 0; k < data.length; k++) {
			const r = arr[i];
			if (r === target) {
				result = i;
				break;
			}
			i += 1;
		}
	} else {
		for (let k = 0; k < data.length; k++) {
			const r = arr[i];
			if (r === target) {
				result = i;
				break;
			}
			i -= 1;
		}
	}
	return result;
}

function search(data, target) {
	let result = null;
	for (let i = 0; i < data.length; i++) {
		if (data[i] === target) {
			result = i;
			break;
		}
	}
	return result;
}

const arr = [];
for (let i = 0; i < 10000000; i++) {
	arr.push(i);
}

const target = 5697000;

console.time('search');
centerSearch(arr, target);
console.timeEnd('search');
